package com.ecoolex.chinadutyfree.retailer.job.scheduler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsProductIncrementDataManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsProductTotalDataManager;
import com.ecoolex.framework.scheduler.Job;
import com.ecoolex.framework.scheduler.JobComponent;

@JobComponent
public class DirectMailGoodsProductDataJob {
	private Logger log = LoggerFactory.getLogger(DirectMailGoodsProductDataJob.class);
	
	@Autowired
	private DirectMailGoodsProductTotalDataManager totalManager;
	
	@Autowired
	private DirectMailGoodsProductIncrementDataManager incrementManager;
	
	@Job(name="chinadutyfree.DirectMailGoodsProductDataJob.productTotalStatistical",describe = "商品总量统计")
	public void productTotalStatisticalProcess() {
		log.info("总量调度={}", DirectMailGoodsProductDataJob.class);
		try {
			totalManager.productTotalData(this.getClass().getSimpleName());
		} catch (Exception e) {
			log.error("商品总量调度异常", e);
		} finally {
			log.info("调度结束={}", DirectMailGoodsProductDataJob.class);
		}
	}
	
	@Job(name="chinadutyfree.DirectMailGoodsProductDataJob.productIncrementStatistical",describe = "商品增量统计")
	public void productIncrementStatisticalProcess() {
		log.info("增量调度={}", DirectMailGoodsProductDataJob.class);
		try {
			incrementManager.productIncrementData(this.getClass().getSimpleName());
		} catch (Exception e) {
			log.error("商品增量调度异常", e);
		} finally {
			log.info("调度结束={}", DirectMailGoodsProductDataJob.class);
		}
	}
}
